class SessionController < ApplicationController
  def new
    #render form
  end

  def create
    respond_to do |format|
      if Profile.count(:conditions => ['email=?', params[:email]]) > 0
        flash[:notice] = 'Successfully logged in'
        format.html {
          session[:logged_in] = true
          redirect_to :home unless session[:request_uri]
          redirect_to session[:request_uri] if session[:request_uri]
        }
      end
    end
  end

  def destroy
    session[:logged_in] = nil
  end
end